<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
    <script src="../js/jquery.table2excel.js"></script>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form enctype="multipart/form-data" method="post" id="upload" role="form">
    <input type="file" name="file">
    输入图片名称<input type="text" name="filename" >
    输入图片绑定的url<input type="text" name="pictureTestUrl" >
    输入图片上传人<input type="text" name="pictureUser" >
    输入图片详情<input type="text" name="pictureDetails" >
    <input type="button" id="but_button" value="上传">



</form>

<script type="text/javascript">

    $("#but_button").click(function () {
        var data = new FormData($("#upload")[0]);
        var data2 = new FormData($("#upload")[1]);
        var data3 = new FormData($("#upload")[2]);
        var data4 = new FormData($("#upload")[3]);

        console.log(data);
        $.ajax({
            "url": "http://192.168.0.108:8081/submit",
            "data": data,data2,data3,data4,
            "type": "POST",
            "processData": false,
            "contentType": false,
            "dataType": "json",
            "success": function (json) {
                if (json.state == 200) {
                    alert("上传成功")
                } else {
                    alert(json.message)
                }
            },
            "error": function () {
                alert("上传出错")
            }
        })
    })
</script>
</body>
</html>